package com.mhkjup.artcircle.controller;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mhkjup.artcircle.service.JC_ZhService;

@Controller
@RequestMapping(value = "/JC_Zh", method = RequestMethod.POST)
public class userJc_ZhConteoller extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Resource(name = "JC_ZhServiceIml")
	private JC_ZhService JC_ZhService;

	/**
	 * 登录接口
	 * 
	 * @param Dlmc
	 *            登录账号
	 * @param Dlpass
	 *            登录密码
	 * @return
	 */
	@RequestMapping(value = "/login", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> login(String Dlmc, String Dlpass) {
		return JC_ZhService.loginJC_ZhDB(Dlmc, Dlpass);
	}

	/**
	 * 
	 * @param Dlmc
	 *            注册账号
	 * @param Dlpass
	 *            注册密码(md5)
	 * @param ZHTel
	 *            注册电话号
	 * @param SyTel
	 *            修改密码所用的电话号码
	 * @param MDNM
	 *            店名
	 * @param MDAdrr
	 *            地址
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/register", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> register(String Dlmc, String Dlpass,
			String ZHTel, String SyTel, String MDNM, String MDAdrr,
			HttpServletRequest request) {
		return JC_ZhService.registerJC_ZhDB(Dlmc, Dlpass, ZHTel, SyTel, MDNM,
				MDAdrr, request);

	}

	/**
	 * 8 修改密码
	 * 
	 * @param Dlmc
	 *            账号
	 * @param newPass
	 *            新密码
	 * @param ondDlpass
	 *            旧密码
	 * @return
	 */
	@RequestMapping(value = "/updateUser", method = RequestMethod.POST)
	@ResponseBody
	public Map<String, Object> updateUser(String Dlmc, String newPass,
			String ondDlpass) {
		return JC_ZhService.updateUserDB(Dlmc, newPass, ondDlpass);

	}

}
